package org.面试题.反射;

import java.lang.reflect.Constructor;

public class reflexDemo {
    public static void main(String[] args) throws Exception {
        Class<Person> personClass = Person.class;
//        Constructor<Person> constructor = personClass.getConstructor();
//        Person person = constructor.newInstance();
        Person person = personClass.newInstance();
        person.setId(1);
        person.setName("xiaoming");
        person.setAge(11);
        person.setSex("无");
        System.out.println(person);

        // Person{id=1, name='xiaoming', age=11, sex='无'}

    }
}
